<template>
  <div class="ts-about-us">
    <ts-header title="关于我们" back></ts-header>
    <div class="ts-middle">
      <svg class="ts-logo-svg" id="组_2" data-name="组 2" xmlns="http://www.w3.org/2000/svg"
           xmlns:xlink="http://www.w3.org/1999/xlink"
           width="127" height="127" viewBox="0 0 127 127">
        <metadata><?xpacket begin="﻿" id="W5M0MpCehiHzreSzNTczkc9d"?>
          <x:xmpmeta xmlns:x="adobe:ns:meta/"
                     x:xmptk="Adobe XMP Core 5.6-c138 79.159824, 2016/09/14-01:09:01        ">
            <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
              <rdf:Description rdf:about=""/>
            </rdf:RDF>
          </x:xmpmeta>
          <?xpacket end="w"?></metadata>
        <image id="矢量智能对象" width="127" height="127"
               xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH8AAAB/CAMAAADxY+0hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB4FBMVEUdnf////8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8dnf8d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wWh/h0G5eku2O8C+/fA/n2wPw72H2D9co5d/40cW/9KwP5DsN8C9gNYv5VjfRPYn8D6wUmsP8Wx/iOwP4D1SznWf4z1/QasX8+h/vQTrG/nWH8c63s51n+K9Wc41K+exfohDvXLDFh/jkN9D4f6vmdQX/+cQ/0ODvVHOdSfMkP9F/Mc6Y+9ZEg/zCP9V68Z0h+KDtvA/DfzDOl7zAzo69/GGw0h/rv3DOl/+MiAfl9FcpOzaL/3k5nh/OnP2pQOf6H+F/l8mzhf3/+VMZi/EAowhvL9MxPfGMP4099DxnaWMar6iz9+On+xrFHJX6z6/WdOyTRtqu+T8k5sKjMoLfx1OTqLh61t7kkFclr/H3z0Rw101nvAAAAAAElFTkSuQmCC"></image>
        <image id="矢量智能对象-2" data-name="矢量智能对象" x="75" y="38" width="22" height="20"
               xlink:href="data:img/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAUCAQAAAAjdQW7AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfhCA8OLRxHahK6AAAA80lEQVQoz42SO0pDURRFV16iRVpRsLNxBgGxFgtRLEVrCzMDxyCkVCvBJp2KMZU2IkjIHCSQ5oGfUgtBzFsWSTTR+O7d5T3rbs7ZbABM3LXtu5+mnrkK4KZNn8x8885thrLsteO69ObXy7nTfbhujI4Al6NQ1UrCHrGqFuyyEAl3sadq1avgGr0EAZjnNuicYarqg3O+BJzThBYAi+yzwmuu8z3ufP+s+5HrvIUlO1Epdyz1WxCj9WE7joPo4U+Vpmzmog2LI4datvEvejFo3AhetDYRPbAwMUg3fB4DH13Lyd1ZTwdg5okzwQq4ZNuWlb+TL44ICLyPVnmyAAAAAElFTkSuQmCC"></image>
        <image id="矢量智能对象-3" data-name="矢量智能对象" x="30" y="32" width="65" height="76"
               xlink:href="data:img/png;base64,i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h7q1Ozhkrrpo9Jppgy0ul1znycD8KIDmJtWdaEmggDAdT/A3ECANl9ELAivGTN7Zj2XbBM+GCarOunG7pnqwoL8thMnI1AKHcfpWYD5gfC3M8ppKlTx8ezi7xcWtvMuQvgWfw/hPMWe4rArAKM85fwVh1MrZmfYAX6y0MlXoMX2WVgBGpjm7ClwkaqCvWFx38VzS/uRFt4U1nLMyH0fqwMv8Jr8ZzMfciIk9628zCTJvjYNy2YNPwXhvJt3uY+WxrYVVFHRg0LsQR48SEfyotLHIAbwG+14j1doVFTypuQfKmc0527dCnYAAAAASUVORK5CYII="></image>
      </svg>
      <p class="ts-middle-version">优服务：{{version || '未发现当前版本,请检查当前设备'}}</p>
      <ts-button class="ts-middle-button" @click="update" plain type="primary">检查更新</ts-button>
    </div>
  </div>
</template>

<script>
  import {VERSION} from '../../assets/js/api'

  export default {
    name: 'aboutUs',
    data() {
      return {
        version: ''
      }
    },
    created() {
      if ($prod) {
        this.version = AppVersion.version;
      }
    },
    methods: {
      async update() {
        if ($prod) {
          const string = device.platform;
          const oldVersion = AppVersion.version;
          const json = await this.$http.get(VERSION, null, {show: true, type: 'mini'});
          if (json.result === 1) {
            const newVersion = string === 'Android' ? json.data.store_android_beta : json.data.store_ios_beta;
            const url = string === 'Android' ? json.data.store_android_url : json.data.store_ios_url;
            const content = json.data.market_content;
            if (oldVersion !== newVersion) {
              //下载安装最新版本
              this.$modal({message: `检测到最新版本${newVersion}，请确认安装。     更新内容: ${content}`, cancel: false})
                .then(action => {
                  window.location.assign(url)
                  this.$toast('正在下载中');
                })
            } else {
              this.$toast('已经是最新版本了');
            }
          }
        } else {
          this.$modal({message: '当前设备不支持', cancel: true, lock: true}).then((value) => {
          }, (reason) => {
          })
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import "../../assets/css/mixin";

  .ts-about-us {
    background-color: #ffffff;
    padding-top: 0;
  }

  .ts-middle {
    flex: 1;
    margin-top: 50%;
    text-align: center;
  }

  .ts-middle .ts-logo-svg {
    width: 1.56rem;
    height: 1.56rem;
  }

  .ts-middle .ts-middle-version {
    font-size: .26rem;
    color: #909090;
    padding: .28rem 0 .26rem;
  }

  .ts-middle .ts-middle-button {
    border-radius: 20px;
  }
</style>
